package cn.jiyun.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.List;

/**
 * @author Fay
 * @date 2022/6/20&16:13
 */

/**
 * 有两种方式
 * 1.使用configuration声明为配置类
 * 2.自己配置配置类
 */
@Configuration //声明为配置类
@ConfigurationProperties(prefix = "user") //引用 配置文件种的user
public class UserProperties {
    //属性名必须与配置文件种的名字引用
    private String username;
    private String password;
    private String age;
    private List<String> hobbys;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    public List<String> getHobbys() {
        return hobbys;
    }

    public void setHobbys(List<String> hobbys) {
        this.hobbys = hobbys;
    }
}
